<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ include file="/page/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/adapter/adapter-bootstrap.jsp" %>
<script type="text/javascript">
	var basePageMake = "${ctx}/auth/appPushMessage";
	
	function rowClickAfter(rowIndex,pk_id) {

		var  arrId = document.getElementsByName("check");
		arrId[rowIndex -1 ].checked=true;	
	}

	// 消息推送
	function doPushMessage(){
		window.location.href="${ctx}/appDeviceRegister/jumpAddDevice?appid=${appid}";
	}

	//查看
	function doViewMessage(){

		if(appId==null||deviceId==null){
			alert("请选择一条记录！");
		}else{
				window.location.href="${ctx}/appDeviceRegister/viewDevice?appid=${appid}&deviceId="+deviceId;
		}
	}	
	
</script>
</head>
<body>
<div class="panel panel-default">
   <div class="panel-heading">
      <h3 class="panel-title">
          请输入查询条件
      </h3>
   </div>
   <div class="panel-body">
<form class="form-horizontal" role="form"  method="post"  action="${ctx}/auth/appPushMessageList?appid=${appid}">
                       <div class="form-group">
                          <label class="col-xs-1 control-label" for="user_id">接收人：</label>
                          <div class="col-xs-3">
                             <input class="input-sm form-control" id="user_id" name="user_id" type="text"/>
                          </div>
                          <label class="col-xs-1 control-label" for="push_alter_msg">消息内容：</label>
                          <div class="col-xs-3">
                             <input class="input-sm form-control" id="push_alter_msg"  name="push_alter_msg"  type="text"/>
                          </div>                          
                          <div class="col-xs-3">
                          	 <button type="submit" class="btn btn-default btn-sm" >查询</button>              
                          </div>
                       </div>
                </form>
   </div>
</div>
<!-- 
			<div class="op-btn">
				<input type="button" class="btn btn-default" value="推送消息"  onclick="doPushMessage()"/> 
				<input type="button" class="btn btn-default" value="查看详情"  onclick="doViewMessage()"/>
			</div>	
 -->
<macms:table dataListName="aptList">
	<macms:html id="ch" label="选择" innerHtml="<input type=\"radio\" name=\"check\" value=\"15\">"></macms:html>
	<macms:text id="pk_id" label="消息唯一标识" align="center"></macms:text>
	<macms:text id="push_time" label="消息推送时间" align="center"></macms:text>
	<macms:text id="push_type" label="推送消息类型" align="center"></macms:text>
	<macms:text id="push_alter_msg" label="推送消息内容" align="center"></macms:text>
	<macms:text id="user_id" label="消息接收人" align="center"></macms:text>

</macms:table>
<script type="text/javascript">
	var preRow = null;
	var appId,deviceId;
	$('tbody tr').bind('click', function() {
	
		var rowIndex = $(this).prevAll().length+1;
		if(rowIndex <1) return;
		
		if(preRow != null){
			preRow.removeClass("active");
		}
		$(this).addClass("active");
		preRow = $(this);
		appId=$(this).find("td").eq(1).text();
		deviceId=$(this).find("td").eq(2).text();

		// 行单击后事件(传入行号，页面标识)
		rowClickAfter(rowIndex,
				$(this).find("td").eq(1).text());
	});
</script>
</body>
</html>
